{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import logging\n",
    "import logging.config\n",
    "import time\n",
    "\n",
    "log_filename = r\"D:/logging.log\"\n",
    "logging.basicConfig(level=logging.INFO,filename=log_filename,\n",
    "    format='[%(asctime)s] %(levelname)s [%(funcName)s: %(filename)s, %(lineno)d] %(message)s',\n",
    "    datefmt='%Y-%m-%d %H:%M:%S',\n",
    "    filemode='a')\n",
    "handler = logging.handlers.RotatingFileHandler(log_filename, maxBytes = 1024*1024, backupCount = 5) # 实例化handler \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[2018-09-12 14:04:21] INFO [<module>: <ipython-input-6-96e00fb0ef89>, 1] ssdsds\n"
     ]
    }
   ],
   "source": [
    "logging.info(\"ssdsds\")\n",
    " "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[2018-09-12 14:02:35] INFO [<module>: <ipython-input-21-1d0a0378bd8e>, 1] ssdsds\n"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
